package spring.cloud.Service;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import spring.cloud.pojo.Depart;

import java.util.ArrayList;
import java.util.List;

/**
 * @author cyt
 * @create 2020-03-16 20:39
 */
@Component
public class DepartServiceCallback implements FallbackFactory {

    @Override
    public DepartClientService create(Throwable throwable) {
        return new DepartClientService() {
            @Override
            public List<Depart> queryAll() {
                List<Depart> list = new ArrayList<Depart>();
                Depart d = new Depart();
                d.setName("没有数据！");
                list.add(d);
                return list;
            }
        };
    }
}
